package com.icreate.storm.methods.indicators.fieldCreater;

import com.icreate.entity.indicator.IndicatorID;
import com.icreate.entity.indicator.S1_MMEfield;
import com.icreate.entity.indicator.S1_Ufield;
import com.icreate.storm.methods.common.DateMethod;
import com.icreate.storm.methods.indicators.fieldCreater.FieldCreater;

/**
 * Created by icreate on 2017/5/21.
 */
public class S1_UfieldCreater extends BaseSubstring implements FieldCreater<S1_Ufield> {
   // private int splitIndexes[] = new int[28];
   private int[] indexsBuffer=new int[78];
   @Override
   protected int[] getIndexBuffer() {
       return indexsBuffer;
   }
    public S1_Ufield create(String s) {
        /*
        String[] cells = s.split(",");
        if (cells.length < 26)
            return null;
        String ts = cells[20];
        String cellid = cells[17];
        String imsi = cells[6];
        String imei = cells[7];
        if (ts.equals("") || cellid.equals("") || imsi.equals(""))
            return null;
        String hour = DateMethod.getHour(ts);
        S1_Ufield field = new S1_Ufield(DateMethod.getDate(ts), cellid, imsi, imei, hour);
        field.setTcp_link_status(cells[51]);
        field.setTcp_creactlink_response_delay(cells[42]);
        field.setTcp_creactlink_confirm_delay(cells[43]);

        field.setApp_status(cells[26]);
        field.setDl_data(cells[35]);
        field.setHttp_lastpacket_1streq_delay(cells[77]);
        field.setTcp_1strequest_delay(cells[46]);

        field.setApp_type(cells[23]);
        field.setApp_sub_type(cells[24]);
        */
        setSplitIndexes(s);
        String ts = getCell(20);//cells[20];
        String cellid =  getCell(17);//cells[17];
        String imsi = getCell(6);//cells[6];
        String imei =  getCell(7);//cells[7];
        if (ts.equals("") || cellid.equals("") || imsi.equals(""))
            return null;
        String hour = DateMethod.getHour(ts);
        S1_Ufield field = new S1_Ufield(DateMethod.getDate(ts), cellid, imsi, imei, hour);
        field.setTcp_link_status( getCell(51));
        field.setTcp_creactlink_response_delay( getCell(42));
        field.setTcp_creactlink_confirm_delay( getCell(43));

        field.setApp_status(getCell(26));
        field.setDl_data( getCell(35));
        field.setHttp_lastpacket_1streq_delay( getCell(77));
        field.setTcp_1strequest_delay( getCell(46));

        field.setApp_type( getCell(23));
        field.setApp_sub_type( getCell(24));
        return field;
    }

}
